<?php

/**
 * This is the model class for table "order_list".
 *
 * The followings are the available columns in table 'order_list':
 * @property string $order_id
 * @property string $order_no
 * @property string $user_id
 * @property string $worker_id
 * @property double $price
 * @property double $square
 * @property integer $type_id
 * @property string $type_name
 * @property string $start_day
 * @property string $end_day
 * @property double $amount
 * @property double $downpay
 * @property integer $pay_method
 * @property string $status
 * @property string $mobile
 * @property string $address
 * @property string $contact_name
 * @property integer $is_delete
 * @property string $create_time
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 * @property string $detail_info
 * @property string $deny_reason
 * @property double $rating_quality
 * @property double $rating_efficiency
 * @property double $rating_satisfaction
 * @property double $rating_manners
 * @property integer $task_day_id
 * @property string $order_take_time
 * @property double $first_pay
 * @property double $second_pay
 * @property double $third_pay
 * @property integer $pay_status
 * @property string $cancel_reason
 * @property integer $check_request_flag
 */
class OrderList extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return OrderList the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'order_list';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('user_id, price, square, order_take_time', 'required'),
			array('type_id, pay_method, is_delete, task_day_id, pay_status, check_request_flag', 'numerical', 'integerOnly'=>true),
			array('price, square, amount, downpay, rating_quality, rating_efficiency, rating_satisfaction, rating_manners, first_pay, second_pay, third_pay', 'numerical'),
			array('order_no, type_name, status, mobile, address, contact_name, created_by, updated_by, deny_reason, cancel_reason', 'length', 'max'=>255),
			array('user_id, worker_id', 'length', 'max'=>64),
			array('start_day, end_day, create_time, update_time, detail_info', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('order_id, order_no, user_id, worker_id, price, square, type_id, type_name, start_day, end_day, amount, downpay, pay_method, status, mobile, address, contact_name, is_delete, create_time, update_time, created_by, updated_by, detail_info, deny_reason, rating_quality, rating_efficiency, rating_satisfaction, rating_manners, task_day_id, order_take_time, first_pay, second_pay, third_pay, pay_status, cancel_reason, check_request_flag', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'order_id' => 'Order',
			'order_no' => 'Order No',
			'user_id' => 'User',
			'worker_id' => 'Worker',
			'price' => 'Price',
			'square' => 'Square',
			'type_id' => 'Type',
			'type_name' => 'Type Name',
			'start_day' => 'Start Day',
			'end_day' => 'End Day',
			'amount' => 'Amount',
			'downpay' => 'Downpay',
			'pay_method' => 'Pay Method',
			'status' => 'Status',
			'mobile' => 'Mobile',
			'address' => 'Address',
			'contact_name' => 'Contact Name',
			'is_delete' => 'Is Delete',
			'create_time' => 'Create Time',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
			'detail_info' => 'Detail Info',
			'deny_reason' => 'Deny Reason',
			'rating_quality' => 'Rating Quality',
			'rating_efficiency' => 'Rating Efficiency',
			'rating_satisfaction' => 'Rating Satisfaction',
			'rating_manners' => 'Rating Manners',
			'task_day_id' => 'Task Day',
			'order_take_time' => 'Order Take Time',
			'first_pay' => 'First Pay',
			'second_pay' => 'Second Pay',
			'third_pay' => 'Third Pay',
			'pay_status' => 'Pay Status',
			'cancel_reason' => 'Cancel Reason',
			'check_request_flag' => 'Check Request Flag',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('order_id',$this->order_id,true);
		$criteria->compare('order_no',$this->order_no,true);
		$criteria->compare('user_id',$this->user_id,true);
		$criteria->compare('worker_id',$this->worker_id,true);
		$criteria->compare('price',$this->price);
		$criteria->compare('square',$this->square);
		$criteria->compare('type_id',$this->type_id);
		$criteria->compare('type_name',$this->type_name,true);
		$criteria->compare('start_day',$this->start_day,true);
		$criteria->compare('end_day',$this->end_day,true);
		$criteria->compare('amount',$this->amount);
		$criteria->compare('downpay',$this->downpay);
		$criteria->compare('pay_method',$this->pay_method);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('mobile',$this->mobile,true);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('contact_name',$this->contact_name,true);
		$criteria->compare('is_delete',$this->is_delete);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);
		$criteria->compare('detail_info',$this->detail_info,true);
		$criteria->compare('deny_reason',$this->deny_reason,true);
		$criteria->compare('rating_quality',$this->rating_quality);
		$criteria->compare('rating_efficiency',$this->rating_efficiency);
		$criteria->compare('rating_satisfaction',$this->rating_satisfaction);
		$criteria->compare('rating_manners',$this->rating_manners);
		$criteria->compare('task_day_id',$this->task_day_id);
		$criteria->compare('order_take_time',$this->order_take_time,true);
		$criteria->compare('first_pay',$this->first_pay);
		$criteria->compare('second_pay',$this->second_pay);
		$criteria->compare('third_pay',$this->third_pay);
		$criteria->compare('pay_status',$this->pay_status);
		$criteria->compare('cancel_reason',$this->cancel_reason,true);
		$criteria->compare('check_request_flag',$this->check_request_flag);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}